package service

import (
	"context"
	"errors"
	__ "shop-microservices/basic/goods_proto"
	"shop-microservices/handler/dao"
)

// WelcomeSearch 首页搜索
func (s *Server) WelcomeSearch(_ context.Context, in *__.WelcomeSearchReq) (*__.WelcomeSearchResp, error) {
	show, err := dao.WelcomeSearchShow(in)
	if err != nil {
		return nil, errors.New("查询品牌失败")
	}
	return &__.WelcomeSearchResp{
		Id:               int64(show.Id),
		BrandName:        show.BrandName,
		BrandLogo:        show.BrandLogo,
		BrandDescription: show.BrandDescription,
	}, nil
}

// WelcomeSearchShopList 首页搜索商品列表
func (s *Server) WelcomeSearchShopList(_ context.Context, in *__.WelcomeSearchShopListReq) (*__.WelcomeSearchShopListResp, error) {
	list, _ := dao.WelcomeSearchShopList(in)
	return &__.WelcomeSearchShopListResp{
		List: list,
	}, nil
}
